package com.vibration.web.controller.vibration;

import com.vibration.baseinfo.domain.CzCollectionTask;
import com.vibration.baseinfo.domain.CzEquipment;
import com.vibration.baseinfo.service.ICzCollectionTaskService;
import com.vibration.baseinfo.service.ICzEquipmentService;
import com.vibration.common.core.controller.BaseController;
import com.vibration.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;


@RestController
@RequestMapping("/vibration")
public class VibrationController extends BaseController{

    @Autowired
    private ICzEquipmentService equipmentService;
    @Autowired
    private ICzCollectionTaskService collectionTaskService;

    //获取设备列表及实时数据
    @GetMapping("/getEquipmentList")
    public AjaxResult getEquipmentList()
    {
        List<CzEquipment> equipmentList = equipmentService.selectEquipmentListAndStatus();
        return AjaxResult.success(equipmentList);
    }

    @GetMapping("/getEquipmentInfo")
    public AjaxResult getEquipmentInfo(String equipmentSn)
    {
        CzEquipment equipment = equipmentService.selectEquipmentInfo(equipmentSn);
        return AjaxResult.success(equipment);
    }

    @GetMapping("/getTaskList")
    public AjaxResult getTaskList(@RequestParam("equipmentSn") String equipmentSn,@RequestParam("type") String type)
    {
        List<CzCollectionTask> collectionTaskList = collectionTaskService.selectTaskDataListByEquipmentSn(equipmentSn,type);
        return AjaxResult.success(collectionTaskList);
    }

}
